#include<iostream>
using namespace std;
const int N = 510;
int arr[N][N];
int n;
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> arr[i][j];
		}
	}
	bool flag = 1;
	int x = 0, y = 0;
	while (x != n || y != n) {
		if (x < n && y < n) {
			cout << arr[x][y] << " ";
		}
		if (flag) {
			x--, y++;
		}
		else {
			x++, y--;
		}
		if (x < 0) {
			x = 0, flag = !flag;
		}
		if (y < 0) {
			y = 0, flag = !flag;
		}
	}
	return 0;
}